#pragma once
#include "HashTable.h"

namespace Set
{
	template <class K, class Hash = HashFunc<K>>
	class unordered_set
	{
		struct SetKeyopt
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};

	public:
		typedef typename HashTable<K, const K, SetKeyopt, Hash>::iterator iterator;

		iterator begin()
		{
			return uset.begin();
		}

		iterator end()
		{
			return uset.end();
		}

		pair<iterator, bool> insert(const K& k)
		{
			return uset.Insert(k);
		}

	private:
		HashTable<K, const K, SetKeyopt, Hash> uset;
	};

	void test_set1()
	{
		unordered_set<int> us;
		us.insert(3);
		us.insert(1);
		us.insert(5);
		us.insert(15);
		us.insert(45);
		us.insert(7);

		unordered_set<int>::iterator it = us.begin();
		while (it != us.end())
		{
			//*it += 100;
			cout << *it << " ";
			++it;
		}
		cout << endl;

		for (auto e : us)
		{
			cout << e << " ";
		}
		cout << endl;
	}
}